package com.javaEE.gamepigeon.controller;


import com.javaEE.gamepigeon.service.LoginService;
import com.javaEE.gamepigeon.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "登录接口")
public class LoginController {

    @Autowired
    LoginService loginService;

    @ApiImplicitParams({
            @ApiImplicitParam(name = "code",value = "微信小程序返回的code",paramType = "query")
    })
    @ApiOperation("登录接口")
    @PostMapping("/login")
    public Result login(String code){
        return loginService.login(code);
    }


    @ApiOperation("测试")
    @PostMapping("hello")
    public Result hello(){
        return Result.success("访问成功！");
    }


}
